const express = require('express')
const app = express()
const config = require('./config')
const cors = require('cors')
app.use(cors());
// 引入bodyParser
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(bodyParser.json({}));
app.use('static', express.static('./public'));
// app.get('/public/images/*', function (req, res) {
//     console.log(req.params);
    
//     res.sendFile(__dirname + "/" + req.url);
// })
// app.use(bodyParser.json({limit:'50mb'}));
// app.use(bodyParser.urlencoded({limit:'50mb',extended:true}));


// 优选
app.use('/api/v1', require('./routes/Optimization.js'))
// 商品信息
app.use('/api/v1', require('./routes/Goods_details.js'))


app.use('/api/v1', require('./routes/gcRoute.js'))
app.use('/api/v1', require('./routes/wpwRoute.js'))
// 手机验证码注册
app.use('/api/v1', require('./routes/Regist.js'))
// 用户登录
app.use('/api/v1', require('./routes/Login.js'))
// 分类
app.use('/api/v1', require('./routes/classify.js'))
// 手机验证码登录
app.use('/api/v1', require('./routes/VerifyLogin.js'))
// 搜索
app.use('/api/v1', require('./routes/Search.js'))
// 启动服务器.js
app.listen(config.server.port, config.server.ip, () => console.log(`http://127.0.0.1:${config.server.port}`))